Skip to content

Guard benchmark summary ratio when branch average is zero#218

Closed
Copilot wants to merge 2 commits into
developfrom
copilot/fix-review-comment-3489157380
Closed

Guard benchmark summary ratio when branch average is zero#218
Copilot wants to merge 2 commits into
developfrom
copilot/fix-review-comment-3489157380

Conversation

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a single review comment on benchmark.sh: the summary awk logic could divide by zero when u1 (branch average user ms) rounded to 0. The change is intentionally scoped to that path only.

  • Summary ratio safety

    • Added an explicit u1 == 0 guard before computing cmp_branch = u2 / u1.
    • Preserved existing summary semantics for normal cases (u1 > 0).
  • Zero-baseline handling

    • u1 == 0 && u2 == 0 → mark as equal, show ratio as 1.00x.
    • u1 == 0 && u2 > 0 → mark as branch faster, show ratio as inf.
    • Avoids awk runtime failure while keeping output readable and deterministic.
if (u1 == 0) {
  if (u2 == 0) {
    cmp_branch = 1
    note = "equal"
    sp = sprintf("%9.2fx", cmp_branch)
  } else {
    note = "branch faster"
    sp = sprintf("%9s", "inf")
  }
} else {
  cmp_branch = u2 / u1
  ...
}

Copilot AI changed the title [WIP] Fix code as per review comment 3489157380 Guard benchmark summary ratio when branch average is zero Jun 29, 2026
Copilot AI requested a review from tameware June 29, 2026 03:54
@tameware tameware closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants